﻿<%@ Page Language="C#" MasterPageFile="~/WebSite.Master" AutoEventWireup="true" CodeBehind="BmCorpList.aspx.cs"
    Inherits="RN.ERP.Web.Exam.BmCorpList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <script type="text/javascript">
        function OpenAlert(text) {
            $.ligerDialog.warn(text);
            return false;
        }
        /*打开添加窗口*/
        function AddOrEditBM(type, id) {
            if ("<%=RoleType %>" == "Manager") {
                return false;
            }
            var url, title;
            var check = false;

            if (type == 1) {//查看
                if (id == 0) {
                    OpenAlert("当前期次未报名！");
                    return false;
                }
                url = "Exam/SelectEmps.aspx?type=1&id=" + id;
                title = "考试报名信息";
                check = true;
            }
            else {
                var chk = $("input:checked");
                var eid = chk.eq(0).val(); //考试id
                var qcid = chk.eq(0).attr("flag"); //期次id
                if (chk.length == 0) {
                    OpenAlert("请选择要操作的报名！");
                    return false;
                }
                $.ajax({
                    async: false,
                    url: "BmList.aspx/CheckQC",
                    data: "{ 'id':'" + qcid + "','roleId':'<%=RoleId %>','appId':'<%=AppID %>'}",
                    type: "post",
                    cache: false,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        var json = eval('(' + data.d + ')');
                        if (json.Message) {
                            if (type == 3) {
                                if (eid == 0) {
                                    OpenAlert("当前期次未报名！");
                                    return false;
                                }
                                url = "Exam/BmChangeList.aspx?type=3&id=" + eid;
                                title = "更换考试报名信息";
                            }
                            else if (type == 2) {
                                if (eid == 0) {
                                    url = "Exam/SelectEmps.aspx?type=0&qcid=" + qcid;
                                    title = "添加考试报名";
                                }
                                else {
                                    url = "Exam/SelectEmps.aspx?type=2&id=" + eid;
                                    title = "修改考试报名";
                                }
                            }
                            check = true;
                        }
                        else {
                            OpenAlert("不在考试报名时间范围内！");
                            return false;
                        }
                    }
                });
            }
            if (check) {
                top.ChildDialog = top.$.ligerDialog.open({ url: url, width: 750, height: 700, title: title, buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
                top.ChildDialogWin = this;
                return false;
            }
        }
        function RefreshWin() {
            location.href = location.href;
        }
        function CloseWin(data) {
            if (data == "1") {
                RefreshWin();
            }
        }
        $(function () {
            $('input[type="checkbox"]').click(function () {
                if ($(this).attr('checked')) {
                    $('input[type="checkbox"]').removeAttr('checked');
                    $(this).attr('checked', 'checked');
                }
            });
            if ('<%=RoleId %>' == "56") {
                $(".change_css").css("display", "none");
            }
        })
    </script>
    <style type="text/css">
        .xtbiao1
        {
            background: none repeat scroll 0 0 #43A9F5;
            color: #FFFFFF;
            float: right;
            height: 25px;
            line-height: 22px;
            margin-left: 10px;
            text-align: center;
            padding-right: 2px;
            padding-left: 2px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table width="100%" style="table-layout: fixed; margin-top: 5px;" border="0" cellspacing="0"
        cellpadding="0" align="center">
        <tr>
            <td class="xx_m  tt_xx_l">
            </td>
            <td class="xx_m  tt_xx_icon">
            </td>
            <td style="width: auto;" class="xx_m">
                考试报名列表
            </td>
            <td style="width: 14px;">
                <img src="../images/xx_r.jpg" width="14" height="33" />
            </td>
        </tr>
        <tr>
            <td class="left_con">
                &nbsp;
            </td>
            <td colspan="2" style="padding-left: 6px; padding-right: 6px;" valign="top">
                <div>
                    <div class="xian">
                        <div class="about_title">
                            <asp:Label ID="lbAreaTitle" runat="server" Text="考试报名列表"></asp:Label></div>
                        <div class="i-con-cn">
                            <span id="change" runat="server" class="change_css"><a style="cursor: pointer;" class="xtbiao1"
                                onclick="AddOrEditBM(3,0);">更换考试报名人员</a></span> <span id="edit" runat="server"><a
                                    style="cursor: pointer;" onclick="AddOrEditBM(2,0);" class="xtbiao1">参加考试报名</a></span>
                            <span id="spReturn" runat="server" visible="false"><a style="cursor: pointer;" class="xtbiao"
                                href="BmManage.aspx">返回</a></span><span style="float: right;">期次：<asp:DropDownList
                                    ID="ddlQC" runat="server" ClientIDMode="Static" AutoPostBack="True" OnSelectedIndexChanged="ddlQC_SelectedIndexChanged">
                                </asp:DropDownList>
                                </span>
                        </div>
                    </div>
                    <telerik:RadGrid ID="RadGrid1" runat="server" ShowStatusBar="True" AllowSorting="true"
                        CssClass="tab" AllowFilteringByColumn="false" CellSpacing="0" Culture="zh-CN"
                        GridLines="None" AllowPaging="true" AllowCustomPaging="true" OnNeedDataSource="RadGrid1_NeedDataSource"
                        Width="100%">
                        <MasterTableView AutoGenerateColumns="false" DataKeyNames="ID" NoMasterRecordsText="暂无数据"
                            InsertItemPageIndexAction="ShowItemOnCurrentPage" CommandItemDisplay="Top">
                            <CommandItemSettings ExportToPdfText="Export to PDF" />
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="true">
                            </RowIndicatorColumn>
                            <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                </EditColumn>
                            </EditFormSettings>
                            <PagerStyle AlwaysVisible="True" />
                            <CommandItemTemplate>
                            </CommandItemTemplate>
                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridTemplateColumn HeaderText="选择" UniqueName="Choose" HeaderStyle-Width="5%"
                                    HeaderStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <input id="ckbChoose" type="checkbox" value='<%#Eval("ID") %>' flag='<%#Eval("QCID") %>'
                                            runat="server" />
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="期次" UniqueName="Title" HeaderStyle-Width="10%"
                                    HeaderStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <a style="cursor: pointer;" onclick='AddOrEditBM(1,<%#Eval("ID") %>);'>
                                            <%#Eval("Title")%></a>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn DataField="Area" HeaderText="所在地" UniqueName="Area" HeaderStyle-Width="8%"
                                    HeaderStyle-HorizontalAlign="Center" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="CorpName" HeaderText="名称" UniqueName="CorpName"
                                    HeaderStyle-Width="15%" HeaderStyle-HorizontalAlign="Center" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="EmpCount" HeaderText="报名人数" UniqueName="EmpCount"
                                    HeaderStyle-Width="8%" HeaderStyle-HorizontalAlign="Center">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="StartDate" SortExpression="StartDate" FilterListOptions="VaryByDataType"
                                    HeaderText="报名开始时间" DataFormatString="{0:yyyy-MM-dd}" UniqueName="BMDate" HeaderStyle-Width="10%"
                                    HeaderStyle-HorizontalAlign="Center">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="EndDate" SortExpression="EndDate" FilterListOptions="VaryByDataType"
                                    HeaderText="报名结束时间" DataFormatString="{0:yyyy-MM-dd}" UniqueName="BMDate" HeaderStyle-Width="10%"
                                    HeaderStyle-HorizontalAlign="Center">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings EnableRowHoverStyle="true">
                            <Selecting AllowRowSelect="True"></Selecting>
                        </ClientSettings>
                        <PagerStyle AlwaysVisible="True" />
                        <FilterMenu EnableImageSprites="False">
                        </FilterMenu>
                    </telerik:RadGrid>
                </div>
            </td>
            <td class="right_con">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="con_m tt_left_bottom">
                &nbsp;
            </td>
            <td colspan="2" class="con_m">
                &nbsp;
            </td>
            <td class="tt_right_bottom">
                &nbsp;
            </td>
        </tr>
    </table>
    <div id="UDialog" style="margin: auto; width: 900px;">
        <telerik:RadAjaxLoadingPanel runat="server" ID="gridLoadingPanel">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
            <Windows>
                <telerik:RadWindow ID="UserDialog" runat="server" Title="考试报名信息" Height="700px" Behaviors="Close"
                    Width="750px" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true"
                    Skin="WebBlue" VisibleStatusbar="False" CssClass="DialogCss">
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
    </div>
    <asp:HiddenField ID="hidArea" runat="server" />
</asp:Content>
